import 'package:flutter/material.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';

//圆形选择框
class RoundCheckBox extends StatefulWidget {
  var value = false;

  Function(bool) onChanged;

  RoundCheckBox({Key key, @required this.value, this.onChanged})
      : super(key: key);

  @override
  _RoundCheckBoxState createState() => _RoundCheckBoxState();
}

class _RoundCheckBoxState extends State<RoundCheckBox> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: GestureDetector(
          onTap: () {
            widget.value = !widget.value;
            widget.onChanged(widget.value);
          },
          child: Padding(
            padding: EdgeInsets.only(
                top: ThemeSize.height6,
                bottom: ThemeSize.height6,
                right: ThemeSize.height10,
                left: ThemeSize.width19),
            child: widget.value
                ? Icon(
                    Icons.check_circle,
                    size: ThemeSize.height16,
                    color: ThemeColor.color1485EE,
                  )
                : Icon(
                    Icons.check_circle_outline,
                    size: ThemeSize.height16,
                    color: ThemeColor.colorCorner,
                  ),
          )),
    );
  }
}
